import Vue from 'vue'
import VueRouter from 'vue-router'
import AdminHome from '../components/admin/index'
import A1 from '../components/admin/testCom/1'
import A2 from '../components/admin/testCom/2'
import A3 from '../components/admin/testCom/3'
import A4 from '../components/admin/testCom/4'
import A5 from '../components/admin/testCom/5'
import A6 from '../components/admin/testCom/6'
import A7 from '../components/admin/testCom/7'
import A8 from '../components/admin/testCom/8'
import A9 from '../components/admin/testCom/9'
import A10 from '../components/admin/testCom/10'


Vue.use(VueRouter)

const routes = [{
  path: '/admin/',
  name: '首页',
  component: AdminHome,
  children: [{
      path: '/admin/1',
      name: '用户列表',
      component: A1
    },
    {
      path: '/admin/2',
      name: '添加用户',
      component: A2
    },
    {
      path: '/admin/3',
      name: '删除用户',

      component: A3
    },
    {
      path: '/admin/4',
      name: '书籍列表',

      component: A4
    },
    {
      path: '/admin/5',
      name: '添加书籍',

      component: A5
    },
    {
      path: '/admin/6',
      name: '评论列表',

      component: A6
    },
    {
      path: '/admin/7',
      name: '登陆日志',
      component: A7
    },
    {
      path: '/admin/8',
      name: '操作日志',

      component: A8
    },
    {
      path: '/admin/9',
      name: '基本信息',

      component: A9
    },
    {
      path: '/admin/10',
      name: '数据统计',

      component: A10
    },
  ]
}, ]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})
const originalPush = VueRouter.prototype.push
   VueRouter.prototype.push = function push(location) {
   return originalPush.call(this, location).catch(err => err)
}
export default router